# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
#   Mayor.create(:name => 'Daley', :city => cities.first)

#clearing the entities
Entity.destroy_all
Friendship.destroy_all

#creating new entities
User.create(:name => 'Adrian', :description => 'Programmer at Waikato Uni', :type => 'User')
User.create(:name => 'Bob', :description => 'Friend of Adrian', :type => 'User')
User.create(:name => 'Bill', :description => 'Another friend of Adrian', :type => 'User')
User.create(:name => 'Ben', :description => 'Friend of Bill and Bob', :type => 'User')
User.create(:name => 'Bam', :description => 'Friend of Bill and Bob', :type => 'User')
User.create(:name => 'Grace', :description => 'Database guru', :type => 'User')
User.create(:name => 'Harry', :description => 'Friend of Grace', :type => 'User')
User.create(:name => 'Hector', :description => 'Another friend of Grace', :type => 'User')
User.create(:name => 'Humphrey', :description => 'Friend of Adrian and Grace', :type => 'User')
User.create(:name => 'Herman', :description => 'Friend of Harry and Bob', :type => 'User')

#establishing relationships
Friendship.create(:entity_id => User.find_by_name("Adrian").id, :friend_id => User.find_by_name("Bob").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Adrian").id, :friend_id => User.find_by_name("Bill").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Bob").id, :friend_id => User.find_by_name("Ben").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Bob").id, :friend_id => User.find_by_name("Bam").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Bill").id, :friend_id => User.find_by_name("Ben").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Bill").id, :friend_id => User.find_by_name("Bam").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Grace").id, :friend_id => User.find_by_name("Harry").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Grace").id, :friend_id => User.find_by_name("Hector").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Adrian").id, :friend_id => User.find_by_name("Humphrey").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Grace").id, :friend_id => User.find_by_name("Humphrey").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Harry").id, :friend_id => User.find_by_name("Herman").id, :accepted => true)
Friendship.create(:entity_id => User.find_by_name("Bob").id, :friend_id => User.find_by_name("Herman").id, :accepted => true)
